home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
WINPROGS
/
INTWHLP1.ZIP
/
INTWHLP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-02-16
|
20KB
|
697 lines
(*
Interrupt List -> WinHelp converter V1.01 (c) 1994 by Christian Müller-Planitz
-----------------------------------------------------------------------------
Author: cmuelle@eos.ncsu.edu, cmueller@techfak.uni-bielefeld.de
The source and the compiled EXE-file can be freely distributed as long as
no changes are made without my knowledge.
--------------------------------
Notes:
The program was tested with INTLIST38 and INTLIST39 and its output
was successfully compiled with the MS-Help-compiler "HC31.EXE" V3.10.445.
The program needs the file "INTWHLP.DAT" in the 'source' directory.
The program converted all sourcefiles (INTERRUP.* and *.LST) to
13 RTF files which needed 11MB on my harddrive.
Compiling the RTF-files without compression took 13 minutes in
a DOS-Window under Win/NT on a 486-50 (if you run it under DOS
and if you have a fast hardrive cache, it might be faster).
The (uncompressed) compiled HLP-File was approximately 7MB large.
If you want to create a compressed HLP-file, you have to exchange the
comments in the generated help-project file ("RB.HPJ"). Compressing
reduces the size of the HLP-file to 3MB but it takes
*more* (?? 28MB ??) space on your harddrive while compiling.
In order to speed up compiling the compressed file, I've included a
temporary file ("RB.PH") of the helpcompiler in this archive.
Copy this file into the directory containing all the RTF files
before starting the compiler. This file is specific for INTERLIST39, so
if you want to get maximal compression in future versions, remove it.
After the compilation finishes, you will find the file "RB.HLP".
Start Windows, create an icon in the program manager and double-click on it.
--------------------------------
If you find this program usefull, if it does not work or if you have ideas
how to expand its functionality, feel fee to write an e-mail to me.
As usual, I do not take any responsibility for possible damages done by
this program.
Two questions and their answers :
---------------------------------
WHY is the HLP-file so large ?
In contrast to other programs that convert the interrupt list to
DOS-based hypertext systems, this program generates a large
index file that allows you to search for keywords.
WHY did I wrote this program in Pascal and not in C ?
I think Pascal is a pretty nice language for small projects.
Another reason is the availability of efficient string handling under Pascal.
*)
{$A+,B-,D-,E-,F-,G+,I+,L-,N-,O-,P-,Q-,R-,S-,T-,V+,X+,Y+}
{$DEFINE ProcessIntList}
{$DEFINE ProcessPorts}
{$DEFINE ProcessMemory}
{$DEFINE ProcessBugs}
{$DEFINE ProcessCMOS}
Program RB2HLP;
CONST InPath : String = 'd:\tmp\';
OutPath : String = 'd:\tmp\out\';
CONST IncludeFile = 'INTWHLP.DAT';
Var OutFileCounter : Word;
IndexFile : Text; { stores *all* section names }
IntFile : Text; { stores one entry per int-number }
SubIntFile : Text; { stores all subfunctions of an int per page }
HPJ : Text; { hlep compiler project file }
TopicNo : Word;
LastSection : String; { stores number of last processed int }
IntTopicStr : String; { stores handle to page with subfunctions of the int's}
Const InvalidClassification = '-';
procedure CreateHPJ;
begin
assign(HPJ, OutPath + 'RB.HPJ');
rewrite(HPJ);
writeln(HPJ, '[OPTIONS]'#10'CONTENTS=CONTENTS'#10'COMPRESS=NO'#10';COMPRESS=YES'#10);
writeln(HPJ, '[CONFIG]'#10'BrowseButtons()'#10);
writeln(HPJ, '[FILES]'#10'index.rtf');
{$IFDEF ProcessIntList}
writeln(HPJ, 'int.rtf'#10'subint.rtf');
{$ENDIF}
end;
Procedure NewHlpPage(VAR F : Text; S, ID : String; Classification : Char);
VAR q : Word;
BrowseID : STring;
Procedure FootNote(Note: Char; ID : String);
begin
writeln(F, '{\up6 ',Note,'{\footnote \pard\plain \s2\f0\fs20\cf0\qj\lotusoutlinelevel0');
writeln(F, '{\up6 ',Note,'}{\field{\*\fldinst SYMBOL 16 \\f "" \\s 10 \\h}}', ID, '}}');
end;
Procedure StoreKeyWords(SS: String);
VAR p : Word;
begin
repeat
p := POS(' - ', ss);
if p <> 0 then
begin
ss[p+1] := ' ';
ss[p+2] := ';';
end;
until p=0;
FootNote('K', SS);
end;
begin
BrowseID := ID;
while Length(BrowseID) < 6 do
insert('0', BrowseID, 1);
write(F, '\page ');
FootNote('#', ID);
FootNote('$', S);
FootNote('+', BrowseID);
if (Classification = InvalidClassification)
then StoreKeyWords(s)
else StoreKeyWords(Classification + ';' + s);
writeln(F, '\pard\plain \s3\f0\fs28\cf1\b\sb144\sa72\lotusoutlinelevel1\keep\keepn {\up6 ', S, '}');
writeln(F, '\par \pard\plain \s4\f1\fs20\cf1\lotusoutlinelevel0 \tx855\tx1710\tx2565\tx3420\tx4275' +
'\tx5130\tx5985\tx6840\tx7695');
end;
Procedure Out(VAR F: Text; S : String);
begin
write(F, S);
end;
{Note: The table is not complete. But for it is sufficient for this purpose * }
Function OEMtoANSI(q: Byte) : Byte;
Const Tab : Array[0..127] of Byte =
( 199,252,233,226,228,224,225,231,234,235,232,239,238,236,196,197,
201,230,198,244,246,242,251,249,253,214,220,162,163,165,182,131,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128);
begin
if q < 128
then OEMtoANSI := q
else OEMtoANSI := Tab[q-128];
end;
Function HEX(b:byte):string;
Const h : array [0..15] of char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
begin
Hex := h[b shr 4]+h[b and 15];
end;
Procedure ReadLine(VAR F: Text; VAR S: String);
VAR q: Word;
c: Byte;
begin
readln(F, S);
q:= 1;
while q <= Length(s) do { duplicate all '\' }
begin
if s[q] = '\' then
begin
insert('\', s, q);
Inc(q);
end;
Inc(q);
end;
q:= 1;
while q <= Length(s) do
begin
c := ord(s[q]);
if c = 9 then
begin
s[q] := '\';
insert('tab ', s, q+1);
Inc(q, 4);
end;
if c >= 128 then { escape all 'Umlaute' }
begin
insert(#39+HEX( OEMtoANSI(ord(s[q])) ), s, q+1);
s[q] := '\';
Inc(q,2);
end;
Inc(q);
end;
end;
Procedure OutLN(VAR F: Text; S : String);
begin
write(F, '\par ');
Out(F, S);
writeln(F);
end;
Procedure AddTopic(VAR F: Text; S, ID : String);
begin
write(F, '\par {\uldb ');
Out(F, s);
write(F, '}{\v ');
Out(F, ID);
writeln(F, '}');
end;
Procedure CopyHeader(VAR F: Text);
VAR F3 : Text;
c : Char;
begin
{$I-}
assign(F3, InPath + 'INTWHLP.DAT');
reset(F3);
{$I+}
if IOResult <> 0 then
begin
writeln('Error opening ', InPath + IncludeFile);
HALT;
end;
{ this is certainly slow, but simple }
while not EOF(F3) do
begin
read(F3, c);
wr